/**
 * @Author: Wang chunsheng  email:2192138785@qq.com
 * @Date:   2024-02-24 00:32:28
 * @Last Modified by:   Wang chunsheng  email:2192138785@qq.com
 * @Last Modified time: 2024-03-10 16:38:58
 */
import request from '@projectName/utils/request'

/**
 * 注册企业微信小程序
 * @param {*} data
 * @returns
 */
export function registerMiniprogram(data) {
  return request({
    url: '/openWeixin/wxapp/registerMiniprogram',
    method: 'post',
    params: data
  })
}

export function registerMiniprogramByOffiaccount(data) {
  return request({
    url: '/openWeixin/wxapp/register-miniprogram-by-offiaccount',
    method: 'post',
    params: data
  })
}

export function registerBetaMiniprogram(data) {
  return request({
    url: '/openWeixin/wxapp/register-beta-miniprogram',
    method: 'post',
    params: data
  })
}

export function fetchConfigInfo(data) {
  return request({
    url: '/wechat/config/info',
    method: 'post',
    params: data
  })
}

export function fetchList(data) {
  return request({
    url: '/api/wx/account/list',
    method: 'post',
    params: data
  })
}

export function createRow(data) {
  return request({
    url: '/api/wx/account/add',
    method: 'post',
    data
  })
}

export function updateRow(data) {
  return request({
    url: '/api/wx/account/update',
    method: 'post',
    data
  })
}
export function deleteRow(data) {
  return request({
    url: '/api/wx/account/delete',
    method: 'post',
    params: data
  })
}

export function fetchAllAccount() {
  return request({
    url: '/api/wx/account/listAll',
    method: 'post'
  })
}

/**
 * 生成授权链接
 * @param {*} data
 * @returns
 */
export function generateQRUrl(data) {
  return request({
    url: '/openWeixin/basics/auth-url',
    method: 'post',
    data
  })
}

export function listTreeWxAccount() {
  return request({
    url: '/api/wx/account/listTreeWxAccount',
    method: 'post'
  })
}
